package com.example.myhuangye;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.Toast;

import com.example.myhuangye.BX.MainBX0ctivity;
import com.example.myhuangye.BX.MainBX1ctivity;
import com.example.myhuangye.BX.MainBX2ctivity;
import com.example.myhuangye.BX.MainBX3ctivity;
import com.example.myhuangye.BX.MainBX4ctivity;
import com.example.myhuangye.BX.MainBX5ctivity;
import com.example.myhuangye.DS.MainDS0ctivity;
import com.example.myhuangye.DS.MainDS1ctivity;
import com.example.myhuangye.DS.MainDS2ctivity;
import com.example.myhuangye.DS.MainDS3ctivity;
import com.example.myhuangye.DS.MainDS4ctivity;
import com.example.myhuangye.DS.MainDS5ctivity;
import com.example.myhuangye.SH.MainSH0ctivity;
import com.example.myhuangye.SH.MainSH1ctivity;
import com.example.myhuangye.SH.MainSH2ctivity;
import com.example.myhuangye.SH.MainSH3ctivity;
import com.example.myhuangye.SH.MainSH4ctivity;
import com.example.myhuangye.SH.MainSH5ctivity;
import com.example.myhuangye.WL.MainWL0ctivity;
import com.example.myhuangye.WL.MainWL1ctivity;
import com.example.myhuangye.WL.MainWL2ctivity;
import com.example.myhuangye.WL.MainWL3ctivity;
import com.example.myhuangye.WL.MainWL4ctivity;
import com.example.myhuangye.WL.MainWL5ctivity;
import com.example.myhuangye.YH.MainYH0ctivity;
import com.example.myhuangye.YH.MainYH1ctivity;
import com.example.myhuangye.YH.MainYH2ctivity;
import com.example.myhuangye.YH.MainYH3ctivity;
import com.example.myhuangye.YH.MainYH4ctivity;
import com.example.myhuangye.YH.MainYH5ctivity;

import static android.R.id.content;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button kuaidi,lianxi,NY,YH2,YH3,YH4,YH5,YH0,wl1,wl2,wl3,wl4,wl5,wl0
        ,sh1,sh2,sh3,sh4,sh5,sh0,ds1,ds2,ds3,ds4,ds5,ds0,bx1,bx2,bx3,bx4,bx5,bx0;
    Toolbar toolbar;//定义变量


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        kuaidi = (Button) findViewById(R.id.kuaidi);
        kuaidi.setOnClickListener(this);
        lianxi=(Button) findViewById(R.id.lianxi);
        lianxi.setOnClickListener(this);
        NY=(Button) findViewById(R.id.NY);//绑定id控件  监听事件
        NY.setOnClickListener(this);
        YH2=(Button) findViewById(R.id.YH2);
        YH2.setOnClickListener(this);
        YH3=(Button) findViewById(R.id.YH3);
        YH3.setOnClickListener(this);
        YH4=(Button) findViewById(R.id.YH4);
        YH4.setOnClickListener(this);
        YH5=(Button) findViewById(R.id.YH5);
        YH5.setOnClickListener(this);
        YH0=(Button) findViewById(R.id.YH0);
        YH0.setOnClickListener(this);

        wl1=(Button) findViewById(R.id.wl1);
        wl1.setOnClickListener(this);
        wl2=(Button) findViewById(R.id.wl2);
        wl2.setOnClickListener(this);
        wl3=(Button) findViewById(R.id.wl3);
        wl3.setOnClickListener(this);
        wl4=(Button) findViewById(R.id.wl4);
        wl4.setOnClickListener(this);
        wl5=(Button) findViewById(R.id.wl5);
        wl5.setOnClickListener(this);
        wl0=(Button) findViewById(R.id.wl0);
        wl0.setOnClickListener(this);

        sh1=(Button) findViewById(R.id.sh1);
        sh1.setOnClickListener(this);
        sh2=(Button) findViewById(R.id.sh2);
        sh2.setOnClickListener(this);
        sh3=(Button) findViewById(R.id.sh3);
        sh3.setOnClickListener(this);
        sh4=(Button) findViewById(R.id.sh4);
        sh4.setOnClickListener(this);
        sh5=(Button) findViewById(R.id.sh5);
        sh5.setOnClickListener(this);
        sh0=(Button) findViewById(R.id.sh0);
        sh0.setOnClickListener(this);

        ds1=(Button) findViewById(R.id.ds1);
        ds1.setOnClickListener(this);
        ds2=(Button) findViewById(R.id.ds2);
        ds2.setOnClickListener(this);
        ds3=(Button) findViewById(R.id.ds3);
        ds3.setOnClickListener(this);
        ds4=(Button) findViewById(R.id.ds4);
        ds4.setOnClickListener(this);
        ds5=(Button) findViewById(R.id.ds5);
        ds5.setOnClickListener(this);
        ds0=(Button) findViewById(R.id.ds0);
        ds0.setOnClickListener(this);

        bx1=(Button) findViewById(R.id.bx1);
        bx1.setOnClickListener(this);
        bx2=(Button) findViewById(R.id.bx2);
        bx2.setOnClickListener(this);
        bx3=(Button) findViewById(R.id.bx3);
        bx3.setOnClickListener(this);
        bx4=(Button) findViewById(R.id.bx4);
        bx4.setOnClickListener(this);
        bx5=(Button) findViewById(R.id.bx5);
        bx5.setOnClickListener(this);
        bx0=(Button) findViewById(R.id.bx0);
        bx0.setOnClickListener(this);


        toolbar= (Toolbar) findViewById(R.id.toobar);
        setSupportActionBar(toolbar);
    }


    public void onClick(View view) {//跳转页面   点击事件//
         switch (view.getId()){
             case R.id.kuaidi:
                 Intent intent1 = new Intent(MainActivity.this, Main2Activity.class);
                 startActivity(intent1);
                 break;
             case R.id.lianxi:
                 Intent intent2 = new Intent(MainActivity.this, Main3Activity.class);
                 startActivity(intent2);
                 break;
             case R.id.NY:
                 Intent intent3 = new Intent(MainActivity.this, MainYH1ctivity.class);
                 startActivity(intent3);
                 break;
             case R.id.YH2:
                 Intent intent4 = new Intent(MainActivity.this, MainYH2ctivity.class);
                 startActivity(intent4);
                 break;
             case R.id.YH3:
                 Intent intent5 = new Intent(MainActivity.this, MainYH3ctivity.class);
                 startActivity(intent5);
                 break;
             case R.id.YH4:
                 Intent intent6 = new Intent(MainActivity.this, MainYH4ctivity.class);
                 startActivity(intent6);
                 break;
             case R.id.YH5:
                 Intent intent7 = new Intent(MainActivity.this, MainYH5ctivity.class);
                 startActivity(intent7);
                 break;
             case R.id.YH0:
                 Intent intent71 = new Intent(MainActivity.this, MainYH0ctivity.class);
                 startActivity(intent71);
                 break;
             case R.id.wl0:
                 Intent intent81 = new Intent(MainActivity.this, MainWL0ctivity.class);
                 startActivity(intent81);
                 break;
             case R.id.wl1:
                 Intent intent8 = new Intent(MainActivity.this, MainWL1ctivity.class);
                 startActivity(intent8);
                 break;
             case R.id.wl2:
                 Intent intent9 = new Intent(MainActivity.this, MainWL2ctivity.class);
                 startActivity(intent9);
                 break;
             case R.id.wl3:
                 Intent intent10= new Intent(MainActivity.this, MainWL3ctivity.class);
                 startActivity(intent10);
                 break;
             case R.id.wl4:
                 Intent intent11 = new Intent(MainActivity.this, MainWL4ctivity.class);
                 startActivity(intent11);
                 break;
             case R.id.wl5:
                 Intent intent12 = new Intent(MainActivity.this, MainWL5ctivity.class);
                 startActivity(intent12);
                 break;
             case R.id.sh0:
                 Intent intent113 = new Intent(MainActivity.this, MainSH0ctivity.class);
                 startActivity(intent113);
                 break;
             case R.id.sh1:
                 Intent intent13 = new Intent(MainActivity.this, MainSH1ctivity.class);
                 startActivity(intent13);
                 break;
             case R.id.sh2:
                 Intent intent14 = new Intent(MainActivity.this, MainSH2ctivity.class);
                 startActivity(intent14);
                 break;
             case R.id.sh3:
                 Intent intent15 = new Intent(MainActivity.this, MainSH3ctivity.class);
                 startActivity(intent15);
                 break;
             case R.id.sh4:
                 Intent intent16 = new Intent(MainActivity.this, MainSH4ctivity.class);
                 startActivity(intent16);
                 break;
             case R.id.sh5:
                 Intent intent17 = new Intent(MainActivity.this, MainSH5ctivity.class);
                 startActivity(intent17);
                 break;
             case R.id.ds0:
                 Intent intent118 = new Intent(MainActivity.this, MainDS0ctivity.class);
                 startActivity(intent118);
                 break;
             case R.id.ds1:
                 Intent intent18 = new Intent(MainActivity.this, MainDS1ctivity.class);
                 startActivity(intent18);
                 break;
             case R.id.ds2:
                 Intent intent19 = new Intent(MainActivity.this, MainDS2ctivity.class);
                 startActivity(intent19);
                 break;
             case R.id.ds3:
                 Intent intent20 = new Intent(MainActivity.this, MainDS3ctivity.class);
                 startActivity(intent20);
                 break;
             case R.id.ds4:
                 Intent intent21 = new Intent(MainActivity.this, MainDS4ctivity.class);
                 startActivity(intent21);
                 break;
             case R.id.ds5:
                 Intent intent22 = new Intent(MainActivity.this, MainDS5ctivity.class);
                 startActivity(intent22);
                 break;
             case R.id.bx0:
                 Intent intent213 = new Intent(MainActivity.this, MainBX0ctivity.class);
                 startActivity(intent213);
                 break;
             case R.id.bx1:
                 Intent intent23 = new Intent(MainActivity.this, MainBX1ctivity.class);
                 startActivity(intent23);
                 break;
             case R.id.bx2:
                 Intent intent24 = new Intent(MainActivity.this, MainBX2ctivity.class);
                 startActivity(intent24);
                 break;
             case R.id.bx3:
                 Intent intent25 = new Intent(MainActivity.this, MainBX3ctivity.class);
                 startActivity(intent25);
                 break;
             case R.id.bx4:
                 Intent intent26 = new Intent(MainActivity.this, MainBX4ctivity.class);
                 startActivity(intent26);
                 break;
             case R.id.bx5:
                 Intent intent27 = new Intent(MainActivity.this, MainBX5ctivity.class);
                 startActivity(intent27);
                 break;

         }

    }
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu,menu);
        return super.onCreateOptionsMenu(menu);
    }
    public boolean onOptionsItemSelected(MenuItem item) {//添加菜单功能
        switch (item.getItemId()){
            case R.id.add_contact:
                Intent share_intent = new Intent();
                share_intent.setAction(Intent.ACTION_SEND);//设置分享行为
                share_intent.setType("text/plain");//设置分享内容的类型
                share_intent.putExtra(Intent.EXTRA_SUBJECT, "ftghf");//添加分享内容标题

                startActivity(share_intent);
                break;
            case R.id.action_search:
                Toast.makeText(this, "感谢您的评价", Toast.LENGTH_SHORT).show();
                break;

            case R.id.menu_setting://点击退出软件//
                Intent intent = new Intent(Intent.ACTION_MAIN);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.addCategory(Intent.CATEGORY_HOME);
                startActivity(intent);
                break;
        }
        return super.onOptionsItemSelected(item);
    }



}

